<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 5.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--common-->
<link href="${pageContext.request.contextPath }/admin/css/style.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath }/admin/css/style-responsive.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath }/admin/css/stuInfoManage/main.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath }/admin/css/stuInfoManage/stuInfoManage.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath }/admin/css/stuInfoManage/stuInfoSearch.css"
	rel="stylesheet">

<title>Insert title here</title>
<script
	src="${pageContext.request.contextPath }/admin/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
	function showFeedbackList() {
		var url = "${pageContext.request.contextPath }/admin/showFeedback.do";
		$.ajax({
					type : "post",
					url : url,
					dataType : 'json',
					success : function(result) {
						var dataObj = result; //返回的result为json格式的数据
						var datas = "<table class='table table-hover' ><th>反馈ID</th><th>反馈用户</th><th>反馈标题</th><th>反馈内容</th><th>反馈时间</th>";
						$.each(dataObj,function(index, feedback) {
							var time = formatDate(feedback.fTime);
											var content = feedback.fContent;
											var title = feedback.fTitle;
											if(title.length > 4)
												title = title.substring(0,6)+"......";
											if(content.length >10)
												content = content.substring(0,8)+"......";
											if (index % 2 == 0)
												datas += "<tr class='warning' onclick=\"showFeedback('"
														+ feedback.fTitle
														+ "','"
														+ feedback.fContent
														+ "')\">";
											else
												datas += "<tr class='info'onclick=\"showFeedback('"
													+ feedback.fTitle
													+ "','"
													+ feedback.fContent
													+ "')\">";
											datas += "<a href='#foo'>"
											datas += "<td>" + feedback.fId
													+ "</td>";
											datas += "<td>" + feedback.uName
													+ "</td>";
											datas += "<td>" + title
													+ "</td>";
											datas += "<td>" + content
													+ "</td>";
											datas += "<td>" + time
													+ "</td></a></tr>";
										});
						datas += "</table>"
						$("#feedbackList").html(datas);
					},
					error : function() {
						alert("失败");
					}
				});
	}

	function showFeedback(title, content) {
		$('#feedTitle').val(title);
		$('#feedContent').val(content);
		$('#showFeedback').modal('show');

	}
	
	function formatDate(date){  
        date = new Date(date);  
        var y=date.getFullYear();  
        var m=date.getMonth()+1;  
        var d=date.getDate();  
        var h=date.getHours();  
        var m1=date.getMinutes();  
        var s=date.getSeconds();  
        m = m<10?("0"+m):m;  
        d = d<10?("0"+d):d;  
        return y+"-"+m+"-"+d+" "+h+":"+m1+":"+s;  
    }  
</script>
</head>
<body class="sticky-header" onload="showFeedbackList()">
	<section> <!-- 导入左边菜单栏 --> <%@include
		file="common/sidebarStart.jsp"%>
	<li class="menu-list "><a href="#"><i class="fa fa-book"></i>
			<span>用户信息管理</span></a>
		<ul class="sub-menu-list">
			<li><a href="${pageContext.request.contextPath }/page.do?url=admin/verify"> 用户信息审核</a></li>
			<li><a
				href="${pageContext.request.contextPath }/page.do?url=admin/userInfoSelect">
					用户信息查询</a></li>
		</ul></li>

	<li class="menu-list nav-active"><a href=""><i
			class="fa fa-tasks"></i> <span>反馈信息管理</span></a>
		<ul class="sub-menu-list">
			<li class="active"><a
				href="${pageContext.request.contextPath }/page.do?url=admin/selectFeedback">
					查看反馈信息</a></li>
		</ul></li>

	<li class="menu-list nav-active"><a href="#"><i
			class="fa fa-th-list"></i> <span>发布公告</span></a>
		<ul class="sub-menu-list">
			<li><a
				href="${pageContext.request.contextPath }/page.do?url=admin/sendNotice">
					网站发布公告 </a></li>
		</ul></li>
	<%@include file="common/sidebarEnd.jsp"%> <!-- 主内容开始-->
	<div class="main-content">
		<!-- 通知菜单栏 -->
		<%@include file="common/notifyMenu.jsp"%>

		<div class="container">
			<div class="row">
				<div class="col-md-2"></div>
				<div class="col-md-8 little-title">管理反馈信息</div>
			</div>
			<div class="row">
				<div class="col-md-1"></div>
				<div class="col-md-10">
					<div class="panel panel-info">
						<div class="panel-heading">用户反馈内容</div>
						<div class="panel-body">
							<p>这是一个基本的面板内容。这是一个基本的面板内容。 这是一个基本的面板内容。这是一个基本的面板内容。
								这是一个基本的面板内容。这是一个基本的面板内容。 这是一个基本的面板内容。这是一个基本的面板内容。</p>
						</div>
						<div class="list-group table-responsive" id="feedbackList">

						</div>
					</div>

				</div>
			</div>
			<div class="col-md-1"></div>
		</div>
	</div>
	</div>
	<!-- 主内容结束--> </section>

	<!-- 模态框（Modal） -->
	<div class="modal fade" id="showFeedback" tabindex="-1" role="dialog"
		aria-labelledby="exampleModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title" id="exampleModalLabel">反馈信息</h4>
				</div>
				<div class="modal-body">
					<form>
						<div class="form-group">
							<label for="recipient-name" class="control-label">标题:</label> <input
								type="text" class="form-control" id="feedTitle"
								readonly="readonly">
						</div>
						<div class="form-group">
							<label for="message-text" class="control-label">内容:</label>
							<textarea class="form-control" id="feedContent" readonly="readonly"></textarea>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<!-- /.modal -->

	<!-- Placed js at the end of the document so the pages load faster -->

	<script type="text/javascript"
		src="${pageContext.request.contextPath }/admin/js/auto.js"></script>
	<script
		src="${pageContext.request.contextPath }/admin/js/jquery-ui-1.9.2.custom.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/admin/js/jquery-migrate-1.2.1.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/admin/js/bootstrap.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/admin/js/modernizr.min.js"></script>
	<script
		src="${pageContext.request.contextPath }/admin/js/jquery.nicescroll.js"></script>

	<!--页面公共脚步-->
	<script src="${pageContext.request.contextPath }/admin/js/scripts.js"></script>


</body>
</html>